﻿namespace Microsoft.SharePoint.Client.WebParts
{
    using Microsoft.SharePoint.Client;
    using System;
    using System.ComponentModel;

    [ScriptType("SP.WebParts.WebPart", ServerTypeId="{612a6bd9-6c99-43c9-813a-8d7e19702118}")]
    public class WebPart : ClientObject
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public WebPart(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "Hidden"))
                {
                    if (str == "IsClosed")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["IsClosed"] = reader.ReadBoolean();
                        return flag;
                    }
                    if (str == "Subtitle")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Subtitle"] = reader.ReadString();
                        return flag;
                    }
                    if (str == "Title")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["Title"] = reader.ReadString();
                        return flag;
                    }
                    if (str == "TitleUrl")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["TitleUrl"] = reader.ReadString();
                        return flag;
                    }
                    if (str == "ZoneIndex")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ZoneIndex"] = reader.ReadInt32();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["Hidden"] = reader.ReadBoolean();
            }
            return flag;
        }

        [Remote]
        public bool Hidden
        {
            get
            {
                base.CheckUninitializedProperty("Hidden");
                return (bool) base.ObjectData.Properties["Hidden"];
            }
            set
            {
                base.ObjectData.Properties["Hidden"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Hidden", value));
                }
            }
        }

        [Remote]
        public bool IsClosed
        {
            get
            {
                base.CheckUninitializedProperty("IsClosed");
                return (bool) base.ObjectData.Properties["IsClosed"];
            }
        }

        [Remote]
        public string Subtitle
        {
            get
            {
                base.CheckUninitializedProperty("Subtitle");
                return (string) base.ObjectData.Properties["Subtitle"];
            }
        }

        [Remote]
        public string Title
        {
            get
            {
                base.CheckUninitializedProperty("Title");
                return (string) base.ObjectData.Properties["Title"];
            }
            set
            {
                base.ObjectData.Properties["Title"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "Title", value));
                }
            }
        }

        [Remote]
        public string TitleUrl
        {
            get
            {
                base.CheckUninitializedProperty("TitleUrl");
                return (string) base.ObjectData.Properties["TitleUrl"];
            }
            set
            {
                base.ObjectData.Properties["TitleUrl"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "TitleUrl", value));
                }
            }
        }

        [Remote]
        public int ZoneIndex
        {
            get
            {
                base.CheckUninitializedProperty("ZoneIndex");
                return (int) base.ObjectData.Properties["ZoneIndex"];
            }
        }
    }
}

